package org.zuoye.action;

import java.util.ArrayList;
import java.util.List;


import java.util.Map;

import org.zuoye.Dao.uploadDao;
import org.zuoye.DaoImp.uploadDaoimp;
import org.zuoye.bean.Zuoye;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class selectAction extends ActionSupport{
	private String stuName;
	private boolean isAdmin;
	private String log="---成功查询到以下数据---";
	List<Zuoye> allList=new ArrayList<>();
	uploadDao upDao=new uploadDaoimp();
	public String getStuName() {
		return stuName;
	}
	public void setStuName(String stuName) {
		this.stuName = stuName;
	}
	public boolean getIsAdmin() {
		return isAdmin;
	}
	public void setIsAdmin(boolean isAdmin) {
		this.isAdmin = isAdmin;
	}
	
	public List<Zuoye> getAllList() {
		return allList;
	}
	public void setAllList(List<Zuoye> allList) {
		this.allList = allList;
	}
	public String execute(){
		allList=upDao.selectZuoye();
		if(getAllList().size()==0)
			setLog("未查询到符合条件的数据！");
		return SUCCESS;
	}
	public String selectName(){
		allList=upDao.selectName(stuName);
		if(getAllList().size()==0)
			setLog("未查询到符合条件的数据！");
		if(getIsAdmin()){
			return SUCCESS;
			}
		else {
			return "student";
		}
		
	}
	public String getLog() {
		return log;
	}
	public void setLog(String log) {
		this.log = log;
	}
}

